home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 2.4 KB | 92 lines | [TEXT/MPS ] |
- // Toolbox.h
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
-
- #ifndef __TOOLBOX__
- #define __TOOLBOX__
-
- // MacApp
-
- #ifndef __MACONDITIONALMACROS__
- #include "MAConditionalMacros.h"
- #endif
-
- // Toolbox
-
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
-
- //----------------------------------------------------------------------------------------
- // CRGBColor
- //----------------------------------------------------------------------------------------
- class CRGBColor : public RGBColor
- {
- public:
- // Constructors
-
- inline CRGBColor()
- { }
-
- inline CRGBColor(unsigned short theRed, unsigned short theGreen, unsigned short theBlue)
- {
- red = theRed;
- green = theGreen;
- blue = theBlue;
- }
-
- inline CRGBColor(const RGBColor& color)
- { *this = *(CRGBColor*)&color; }
-
- //------------------------------------------------------------------------------------
- // Copy and conversion operator methods
- //------------------------------------------------------------------------------------
-
- // Used to create a toolbox type RGBColor* from our CRGBColor. This is simply a type
- // coercion!
-
- inline operator RGBColor*()
- { return this; }
-
- inline operator const RGBColor*() const
- { return this; }
-
- // Comparison operators
-
- Boolean operator ==(const CRGBColor& color) const;
- inline Boolean operator !=(const CRGBColor& color) const
- { return !(*this == color); }
-
- // Arithmetic, by another color
-
- CRGBColor operator +(const CRGBColor& color) const;
- CRGBColor operator -(const CRGBColor& color) const;
- CRGBColor operator *(const CRGBColor& color) const;
- CRGBColor operator /(const CRGBColor& color) const;
-
- CRGBColor& operator +=(const CRGBColor& color);
- CRGBColor& operator -=(const CRGBColor& color);
- CRGBColor& operator *=(const CRGBColor& color);
- CRGBColor& operator /=(const CRGBColor& color);
-
- // Arithmetic by a scalar
-
- CRGBColor operator +(const unsigned short a) const;
- CRGBColor operator -(const unsigned short a) const;
- CRGBColor operator *(const unsigned short a) const;
- CRGBColor operator /(const unsigned short a) const;
-
- CRGBColor& operator +=(const unsigned short a);
- CRGBColor& operator -=(const unsigned short a);
- CRGBColor& operator *=(const unsigned short a);
- CRGBColor& operator /=(const unsigned short a);
- };
-
- //
- // miscellaneous calls that simplify coding just the teensiest little bit
- //
- inline void MoveToPt(Point p) { ::MoveTo(p.h, p.v); }
- inline void LineToPt(Point p) { ::LineTo(p.h, p.v); }
-
- #endif
-